<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>固定定位</title>
    <style>
        div {
            background: pink;
            /* 固定定位 */
            position: fixed;
            width: 1200px;
            left: 50%;
            transform: translateX(-50%);
            line-height: 80px;
        }
    </style>
</head>

<body>
    <div>固定的导航栏</div>
    <section style="height: 3000px;"></section>
</body>

</html>